home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 742 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.8 KB

  1. From: bill@amber.ssd.hcsc.com (Bill Leonard)
  2. Message-ID: <4ictq6$r43@ns.hcsc.com>
  3. X-Original-Date: 15 Mar 1996 23:17:26 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 16 Mar 96 10:17:19 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Return-Path: <daemon@meeker.UCAR.EDU>
  8. Newsgroups: comp.std.c++
  9. Subject: Re: String value of enum
  10. Organization: Harris Computer Systems, Ft. Lauderdale FL
  11. References: <4i5sf3$89c@hermes.is.co.za> <Do81tp.H9u@rsvl.unisys.com>  <4i8a38$2qq@engnews1.Eng.Sun.COM> <4i9cn4$7cf@ns.hcsc.com> <KANZE.96Mar15151356@gabi.gabi-soft.fr>
  12. Reply-To: Bill.Leonard@mail.hcsc.com
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMUqVTOEDnX0m9pzZAQGt8gGAgDkpokQ/XILnz31JbigFS07mWpQ4QEU5
  15.     j+A9xI3szM38Rx9f31GYqwRYtV+vgH2v
  16.     =phno
  17.  
  18. In article <KANZE.96Mar15151356@gabi.gabi-soft.fr>, kanze@gabi-soft.fr
  19. (J. Kanze) writes:
  20.  
  21. > At start-up, yes.  If the map is large enough for this to make a
  22. > difference, however, it's likely that the difference between the O(ln n)
  23. > binary search and a O(k) hash table look-up is also significant.
  24.  
  25. I wasn't thinking of a large table, I was thinking of lots of small ones.
  26.  
  27. > Given that the enum labels are all in the source code, and programmers
  28. > being on the whole a lazy group of people, the resulting tables are
  29. > typically so small that it really doesn't make a difference, especially
  30. > since anytime that the conversion is necessary, output will follow.
  31.  
  32. I agree that the performance of the conversion itself is not an issue.
  33. However, startup cost might be if you have lots of these tables in an
  34. application whose execution is normally of very short duration.  Adding 100
  35. milliseconds, say, to an application that only executes for a few hundred
  36. milliseconds anyway is a big penalty.
  37.  
  38. My point is simply that static initialization is better, I think.
  39.  
  40. -- 
  41. Bill Leonard
  42. Harris Computer Systems Corporation
  43. 2101 W. Cypress Creek Road
  44. Fort Lauderdale, FL  33309
  45. Bill.Leonard@mail.hcsc.com
  46.  
  47. These opinions and statements are my own and do not necessarily reflect the
  48. opinions or positions of Harris Computer Systems Corporation.
  49.  
  50. ------------------------------------------------------------------------------
  51. There's something wrong with an industry in which amazement is a common
  52. reaction to things going right.
  53.  
  54. "Hard work never scared me.  Oh, sure, it has startled me from a distance."
  55.                                                        -- Professor Fishhawk
  56. ------------------------------------------------------------------------------
  57. ---
  58. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  59. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  60. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  61. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  62. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  63.